const MyPromise = require('./myPromise')
// import MyPromise from './promiseTest'

function p1() {
    return new MyPromise((resolve, reject) => {
        setTimeout(() => {
            resolve('p1')
        }, 1000)
    })
}

function p2() {
    return new MyPromise((resolve, reject) => {
        // reject('failed')
        resolve('succeed!')
    })
}

p1()
    .then(value => console.log(value))
    .catch(reason => console.log(reason))

MyPromise.all(['a', 'b', p1(), p2(), 'c']).then(result => console.log('promise.all result = ', result))